package org.wrigut.scanlib;

/* KeywordTranslator.java
 * 
 * Project 1 - CS 3361
 * 
 * Authors: Chris Gutierrez
 *          Jordan Wright
 */

public class KeywordTranslator {
	
	public KeywordTranslator() {}
	
	//Changes the type of an id token t if it is a special keyword
	//Doesn't do anything otherwise
	public void translate(Token t) {
		//not an id?
		if (t.getType() != TokenType.id) return;
		//look for a translation
		if (t.getValue().equals("read")) {
			t.changeType(TokenType.read);
		}
		if (t.getValue().equals("write")) {
			t.changeType(TokenType.write);
		}
	}
}
